<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style type="text/css">
        * {
            margin: 0;
            padding: 0;
        }

        body {
            height: 10000px;
            /* width: 4000px; */
        }

        #nav {
            height: 80px;
            border: 2px solid  gray;
        }

        #search {
            margin: 0 auto;
            width: 400px;
            height: 30px;
            border: 1px solid red;
            border-radius: 15px;
            padding-left: 20px;
            padding-top: 4px;
        }
    </style>
    <script src="../../jquery/jquery-3.4.1.min.js"></script>
    <script>
        var left=0;
        $(document).ready(function () {
            left=$("div#search").offset().left;
        })
        $(document).scroll(function () {
            var se = $("div#search");
            if ($(document).scrollTop() >= 84) {
                se.css({"position": "fixed", "left": (left+"px"), "top": "5px"});
            } else {
                se.css({"position": "static"});
            }
        })
    </script>
</head>
<body>
<div id="nav"></div>
<div id="search">
    <form>
        <input name="wd" type="search"/><input type="submit" value="搜索"/>
    </form>
</div>
</body>
</html>